package com.springboot.study.tests.annotation;

import lombok.Getter;

/**
 * @Author: guodong
 * @Date: 2021/7/24 16:04
 * @Version: 1.0
 * @Description:
 */
public enum FromEnum2 implements EnumValidate<String>{

    /**
     * 来源1
     */
    form1("form1"),

    /**
     * 来源2
     */
    form2("form2");

    @Getter
    String from;

    FromEnum2(String from) {
        this.from = from;
    }

    public static FromEnum of(String desc) {
        for (FromEnum from : FromEnum.values()) {
            if (from.getFrom().equalsIgnoreCase(desc)) {
                return from;
            }
        }
        return null;
    }

    @Override
    public boolean inEnum(String value){
        return of(value) != null;
    }

}
